<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>


<script type="text/javascript">
	$(document).ready(function() {
		$("#userDetailsForm").validate({
			rules : {
				username : {
					required : true
				}
			},
			messages : {
				username : {
					required : "请输入昵称。"
				}
			}
		});
	});
	
</script>
<div id="userView">
	<c:if test="${userDetails!=null}">
		<form:form commandName="userDetails" id="userDetailsForm"
			action="member/userdetail/update" method="post" class="form-horizontal">
			<div class="control-group">
				<label class="control-label" for="username">昵称：</label>
				<div class="controls">
					<form:input path="userId" type="hidden" value="${userId}" />
					<form:input path="username" type="text"
						value="${userDetails.username}" />
					<form:errors path="username" />
				</div>
			</div>

			<div class="control-group">
				<label class="control-label" for="name">真实姓名：</label>
				<div class="controls">
					<form:input path="name" type="text" value="${userDetails.name}" />
				</div>
			</div>

			<div class="control-group">
				<label class="control-label" for="gender">性别：</label>
				<div class="controls">
					<c:choose>
						<c:when test="${userDetails.gender=='男'}">
							<form:radiobutton path="gender" value="男" checked="checked" />男
						&nbsp;&nbsp;&nbsp;&nbsp; 
						<form:radiobutton path="gender" value="女" />
						女
					</c:when>
						<c:otherwise>
							<form:radiobutton path="gender" value="男" />男
						&nbsp;&nbsp;&nbsp;&nbsp; 
						<form:radiobutton path="gender" value="女" checked="checked" />
						女
					</c:otherwise>
					</c:choose>
				</div>
			</div>

			<div class="control-group">
				<label class="control-label" for="birthday">出生日期：</label>
				<div class="controls">
					<form:input path="birthday" type="text"	value="${userDetails.birthday}" />
				</div>
			</div>

			<div class="control-group">
				<label class="control-label" for="province">所在城市：</label>
				<div class="controls">
					<form:input path="province" type="text"
						value="${userDetails.province}" />
					<form:input path="city" type="text" value="${userDetails.city}" />
				</div>
			</div>
			
			<div class="control-group">
				<label class="control-label" for="seachPhone">是否可用手机搜索到：</label>
				<div class="controls">
				     <c:choose>
						<c:when test="${userDetails.seachPhone==1}">
							<form:radiobutton path="seachPhone" value="1" checked="checked" />是
						&nbsp;&nbsp;&nbsp;&nbsp; 
						<form:radiobutton path="seachPhone" value="0" />
						否
					</c:when>
						<c:otherwise>
							<form:radiobutton path="seachPhone" value="1" />是
						&nbsp;&nbsp;&nbsp;&nbsp; 
						<form:radiobutton path="seachPhone" value="0" checked="checked" />
						否
					</c:otherwise>
					</c:choose>
					<form:errors path="seachPhone" />
				</div>
			</div>
			
			<div class="control-group">
				<label class="control-label" for="showPosition">是否公开位置：</label>
				<div class="controls">
				    <c:choose>
						<c:when test="${userDetails.showPosition==1}">
							<form:radiobutton path="showPosition" value="1" checked="checked" />是
						&nbsp;&nbsp;&nbsp;&nbsp; 
						<form:radiobutton path="showPosition" value="0" />
						否
					</c:when>
						<c:otherwise>
							<form:radiobutton path="showPosition" value="1" />是
						&nbsp;&nbsp;&nbsp;&nbsp; 
						<form:radiobutton path="showPosition" value="0" checked="checked" />
						否
					</c:otherwise>
					</c:choose>
					<form:errors path="showPosition" />
				</div>
			</div>
			
			<div class="control-group">
				<label class="control-label" for="showPhone">是否公开手机号：</label>
				<div class="controls">
				      <c:choose>
						<c:when test="${userDetails.showPhone==1}">
							<form:radiobutton path="showPhone" value="1" checked="checked" />是
						&nbsp;&nbsp;&nbsp;&nbsp; 
						<form:radiobutton path="showPhone" value="0" />
						否
					</c:when>
						<c:otherwise>
							<form:radiobutton path="showPhone" value="1" />是
						&nbsp;&nbsp;&nbsp;&nbsp; 
						<form:radiobutton path="showPhone" value="0" checked="checked" />
						否
					</c:otherwise>
					</c:choose>
					<form:errors path="showPhone" />
				</div>
			</div>
			
			<div class="control-group">
				<label class="control-label" for="showName">是否公开真实姓名：</label>
				<div class="controls">
				    <c:choose>
						<c:when test="${userDetails.showName==1}">
							<form:radiobutton path="showName" value="1" checked="checked" />是
						&nbsp;&nbsp;&nbsp;&nbsp; 
						<form:radiobutton path="showName" value="0" />
						否
					</c:when>
						<c:otherwise>
							<form:radiobutton path="showName" value="1" />是
						&nbsp;&nbsp;&nbsp;&nbsp; 
						<form:radiobutton path="showName" value="0" checked="checked" />
						否
					</c:otherwise>
					</c:choose>
					<form:errors path="showName" />
				</div>
			</div>

			<div class="control-group">
				<div class="controls">
					<button type="submit" class="btn">保存</button>
				</div>
			</div>

		</form:form>
	</c:if>
	<c:if test="${userDetails==null }">
		<h3>该用户还未完善资料，</h3>
	</c:if>
</div>
